package com.homework;

import java.util.Random;

public class demo09 {
    public static void main(String[] args) {
        //定义数组
        int[] arr = new int[10];
        //随机数
        Random r = new Random();
        System.out.println("转换前的元素顺序如下：");
        //遍历数组，存入10个随机数
        for (int i = 0; i < arr.length; i++) {
            arr[i]=r.nextInt(1,101);
            System.out.print(arr[i]+" ");
        }
        System.out.println();
        //定义一个变量temp储存arr[0]
        int temp = arr[0];
        for (int i = 0; i < arr.length; i++) {
            if(i==arr.length-1){
                arr[i]=temp;
                break;
            }
            arr[i]=arr[i+1];
        }
        System.out.println("转换后的元素顺序如下：");
        for (int i = 0; i < arr.length; i++) {
            System.out.print(arr[i]+" ");
        }
    }
}
